<div class="span3">

	<div class="side_nav sidebar-nav" data-spy="affix" data-offset-top="0">
		<div class="sidebar_widget first_widget group">
			<form class="sidebar_search form-search">
                <input type="text" class="input-medium search-query" placeholder="Quick search">
                <button type="submit" class="btn btn-inverse"><i class="icon-search icon-gray"></i></button>
			</form>
		</div>

		<h3 class="main_menu group">
			<span class="title"><?= lang('dashboard') ?></span>
			<a id="nav_list_btn" class="btn-collapse btn btn-inverse">
				<span class="sweet-gray sweet-go-back-from-screen">&nbsp;</span>              
			</a>
		</h3>

		<ul class="nav nav-list">                          
			<li class="<?= $active_menu_id ? '' : 'active' ?>"><a class="home" href="<?= url_create('admin') ?>"><?= lang('dashboard') ?></a></li>
			<?php

			function menu_create($menus, $breadcrumb, $curr_menu_id, $root = false) {
				foreach ($menus as $menu) {
					if ($root && $menu->p_id != 0 || ($menu->id == $menu->p_id))
						continue;
					$has_children = count($menu->children) > 0;
					?>
					<li class="<?= ($has_children ? 'sub' : '') ?> <?= (in_array($menu->id, $breadcrumb) ? ' active open' : ($curr_menu_id == $menu->id ? 'active' : '')) ?>"    >
						<a class="<?= $menu->class ?>" href="<?= url_create('admin', $menu->controller) ?>"><?= $menu->name ?><?= ($has_children ? '<span>' . count($menu->children) . '</span>' : '') ?></a>
						<?php
						if ($has_children) {
							?>
							<ul>
								<?php menu_create($menu->children, $breadcrumb, $curr_menu_id); ?>
							</ul>
						<?php }
						?>
					</li>
				<?
				}
			}

			menu_create($menus, $breadcrumb, $active_menu_id, true);
			//pr($breadcrumb);
			?>


		</ul>
	</div><!--/.well -->
</div><!--/span-->